#ifndef PM_H
#define PM_H

#include <QDialog>
#include <QtSql>
#include <QPoint>
#include <QMenu>
#include <QFileDialog>
#include "createprodialog.h"
#include "project.h"
#include "common.h"
#include "updatepronamedlg.h"
#include "managementdatabaseoperations.h"
#include "projectdatabaseoperations.h"
#include "tabledefine.h"
#include "errorcode.h"
#include "errortodo.h"

namespace Ui {
class PM;
}

class PM : public QDialog
{
    Q_OBJECT
    
public:
    explicit PM(QDialog *parent = 0);
    ~PM();
    
    bool copyFileToPath(QString sourceDir ,QString toDir, bool coverFileIfExist);
    
private slots:
    void on_tableView_customContextMenuRequested(const QPoint &pos);
    
    void createPro();
    
    void deletePro();
    
    void openPro();
    
    void importPro();
    
    void exportPro();
    
    void updateProName();
    
private:
    Ui::PM *ui;
    
    QSqlQueryModel *model;
    
    QPoint rightMousePos;
    
    QAction *actionDelPro;
    
    QAction *actionOpenPro;
    
    QAction *actionExportPro;
    
    QAction *actionUpdateProName;
    
    ErrorToDo *error;
    
    bool setMouseRightClickMenu();
    
    void updateTableView();
    
    void addProjectToDB(QString proName);
};

#endif // PM_H
